#include <bits/stdc++.h>

template <typename T> T read() {
	T x = 0, f = 1; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = ~f + 1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ '0');
	return x * f;
}

const int N = 1e6 + 10;
int n, m, rk[N], height[N], sa[N], c[N], x[N], y[N]; char s[N];

void Suffix_sort() {
	for (int i = 1; i <= n; i++) ++c[x[i] = s[i]];
	for (int i = 2; i <= m; i++) c[i] += c[i - 1];
	for (int i = n; i; i--) sa[c[x[i]]--] = i;
	for (int k = 1; k <= n; k <<= 1) {
		int num = 0;
		for (int i = n - k + 1; i <= n; i++) y[++num] = i;
		for (int i = 1; i <= n; i++) if (sa[i] > k) y[++num] = sa[i] - k;
		for (int i = 1; i <= m; i++) c[i] = 0;
		for (int i = 1; i <= n; i++) ++c[x[i]];
		for (int i = 2; i <= m; i++) c[i] += c[i - 1];
		for (int i = n; i; i--) sa[c[x[y[i]]]--] = y[i], y[i] = 0;
		std::swap(x, y); num = 1; x[sa[1]] = 1;
		for (int i = 2; i <= n; i++)
			if (y[sa[i]] == y[sa[i - 1]] && y[sa[i] + k] == y[sa[i - 1] + k])
				x[sa[i]] = num;
			else x[sa[i]] = ++num;
		if (num == n) return;
		m = num;
	} return;
}

void get_LCP() {
	std::swap(rk, x); int k = 0;
	for (int i = 1; i <= n; i++) {
		if (rk[i] == 1) continue;
		if (k) k--;
		int j = sa[rk[i] - 1];
		while (i + k <= n && j + k <= n && s[i + k] == s[j + k]) k++;
		height[rk[i]] = k;
	} return;
}

int main() {
	m = 'z'; scanf("%s", s + 1); n = strlen(s + 1);
	Suffix_sort(); //get_LCP();
	for (int i = 1; i <= n; i++) printf("%d ", sa[i]); putchar(10);
	//for (int i = 1; i <= n; i++) printf("%d ", height[i]); putchar(10);
	return !1;
}
//luogu P3809 后缀排序